<template>
    <div>
    <el-menu
            background-color="#545c64"
            text-color="#fff"
            :unique-opened="true"
            active-text-color="#ffd04b"
            style="height: 100vh;"
            default-active="/Home"
            :collapse="isCollapse"
            :collapse-transition="false"
            router>

        <el-menu-item index="/Home">
        <i class="el-icon-s-home"></i>
        <span slot="title">首页</span>
        </el-menu-item>

        <el-submenu :index="first.path" v-for="(first,index) in leftMenu">
            <template slot="title">
                <i :class="first.icon"></i>
                <span style="margin-left: 15px">{{first.menuName}}</span>
            </template>
            <el-menu-item-group>
                <el-menu-item :index="second.path" v-for="second in first.children">
                    <i :class="second.icon"></i>
                    <span slot="title" style="margin-left: 15px">{{second.menuName}}</span>
                </el-menu-item>
            </el-menu-item-group>
        </el-submenu>

    </el-menu>
    </div>
</template>

<script>
    export default {
        name: "Aside",
        data(){
            return{
                //isCollapse:false
                leftMenu:[],
            }
        },
        methods:{
            initLeftMenu(){
                this.$axios.get("/system/api/menu/leftMenu").then(r=>{
                    this.leftMenu=r.data.t;
                })
            }
        },
        created() {
            this.initLeftMenu();
        },
        props:{
            isCollapse: Boolean
        }
    }
</script>

<style scoped>

</style>
